<?php

namespace app\librarys;

use yii\web\Controller;

class BaseController extends Controller
{
    /**
     * @param null|array|mixed $data
     * @param int $status 0:success
     * @param string $message
     * @return string   json result
     */
    public function renderJson($data = null, $status = 0, $message = 'success')
    {
        $result = [
            'status' => $status,
            'message' => $message,
            'data' => $data
        ];


        return json_encode($result, true);
    }
}